﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ASPItalia.ModelVirtualCasting.Common;
using ASPItalia.ModelVirtualCasting.ObjectModel;
using System.Linq.Expressions;

namespace ASPItalia.ModelVirtualCasting.EntityFramework
{
    public class PersonRepository : BaseRepository<Person>, IPersonRepository
    {
        public PersonRepository(IContextContainer container) : base(container) {  }

        public IQueryable<Person> GetAll()
        {
					return CurrentObjectSet;
        }

        public IQueryable<Person> Where(Expression<Func<Person, bool>> predicate)
        {
					return CurrentObjectSet.Where(predicate);
        }

        public long Count(Expression<Func<Person, bool>> predicate)
        {
					return CurrentObjectSet.Count(predicate);
        }

        public IPersonRepository Include(string path)
        {
					CurrentObjectSet.Include(path);
					return this;
        }

        public IPersonRepository EnableLazyLoading()
        {
            SetLazyLoading(true);
            return this;
        }

        public IPersonRepository DisableLazyLoading()
        {
            SetLazyLoading(false);
            return this;
        }
    }
}
